package com.ydd.util.gson;

import android.util.Log;

import com.google.gson.Gson;

import org.json.JSONObject;

/**
 * Created by tao on 17-3-15.
 */

public class JsonHandleUtil {


    public static Object handleResponse(Object responseObj, Class<?> mClass) {
        Object object = null;
        try {

            JSONObject result = new JSONObject(responseObj.toString());
            Log.e("333333333333333",result.toString());
            //将json数据转为实体对象
            Gson gson = new Gson();
            object = gson.fromJson(String.valueOf(result), mClass);
            //正确的转为了实体对象
            if (object != null) {
                return object;
            } else {
            }

        } catch (Exception e) {
            Log.e("111111111111111111111",e.getMessage());
        }

        return object;
    }
}
